package stocks.client.gui.view;

import java.awt.Dimension;
import java.awt.FlowLayout;

import stocks.client.gui.controller.actions.WithdrawStockAction;
import stocks.client.gui.model.model;

import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;

public class withdrawFrame extends JFrame{


	private JTextField transID;
	private JLabel lblTransID;
	private JPanel topPanel;
	private JButton btnWithdraw;
	
	private Action withdrawAction;
	
	public withdrawFrame(model m)
	{
		withdrawAction = new WithdrawStockAction(m);
		lblTransID = new JLabel("Transaction ID");
		transID = new JTextField();
		btnWithdraw = new JButton(withdrawAction);
		btnWithdraw.setText("Withdraw");
		transID.setPreferredSize(new Dimension(80,20));
		
		topPanel = new JPanel();
    	topPanel.setPreferredSize(new Dimension(400,400));
    	topPanel.setLayout(new FlowLayout());
    	this.getContentPane().add(topPanel);
    	
    	topPanel.add(lblTransID);
    	topPanel.add(transID);
		topPanel.add(btnWithdraw);
		
		this.setTitle("Withdraw Order");
		this.setResizable(false);
		this.setLocationRelativeTo(null); //set frame to middle of screen
    	this.setSize(500,100);
	}
	
	public String getTransactionID()
	{
		return transID.getText();
	}
}
